<?php

namespace app\admin\model\invest;

use think\Model;


class Applyfor extends Model
{

    

    

    // 表名
    protected $name = 'invest_apply_for';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'is_invest_text',
        'status_text'
    ];
    

    
    public function getIsInvestList()
    {
        return ['invest' => __('Is_invest invest'), 'shop' => __('Is_invest shop')];
    }

    public function getStatusList()
    {
        return ['pending' => __('Status pending'), 'through' => __('Status through'), 'dismiss' => __('Status dismiss'), 'withdraw' => __('Status withdraw')];
    }


    public function getIsInvestTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['is_invest']) ? $data['is_invest'] : '');
        $list = $this->getIsInvestList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
